<?php

/*

  Action - Attack	$3 + 1 potion

  +1 Card; +1 Action
  Each other player gains a curse.

 */

class Familiar extends Card implements iAction, iKingdom, iAttack, iAlchemy {

    public function __construct() {
        $price = new Price(3, 1);
        parent::__construct("Familiar", $price);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }
    
        public function getDescription() {
        return array(
            "+1 Card",
            "+1 Action",
            "Each other player gains a curse.");
    }

    public function play(Game $game, $isRealCard) {
        $game->addActions(1);
        $drawed_cards = $game->drawCards(1);
         ScreenDisplay::addScreenMessage($game, true, "get +1 action and draw " . nicePrint($drawed_cards), "get +1 action and draws " . sizeof($drawed_cards) . " cards");
         
        $game->attack($this);
        $names = $game->getOtherPlayersNames(true);
        
        foreach ($names as $name) {
            $curse = $game->moveCardFromPileToPile("Curse", BoardCards, DiscardPile, $name);
            ScreenDisplay::addScreenMessage($game, true, "gain " . nicePrint($curse), "gains " . ScreenDisplay::$LMSG, $name);
        }
        $game->cardActionFinished();
        return true;
    }
    
        public function boardSetup(Game $game) {
        $game->addPotion();
        return true;
    }

}

?>